Skip to content

Adding placeOfCurrentLiving, otherPlaceOfCurrentLiving and institutio… - #175

Merged
vishwab1 merged 1 commit into
PSMRI:release-3.8.4from
sehjotsinghunthinkable:feature/non-household
Jul 16, 2026
Merged

Adding placeOfCurrentLiving, otherPlaceOfCurrentLiving and institutio…#175
vishwab1 merged 1 commit into
PSMRI:release-3.8.4from
sehjotsinghunthinkable:feature/non-household

Conversation

@sehjotsinghunthinkable

Copy link
Copy Markdown
Contributor

JIRA ID: https://support.piramalfoundation.org/jira/browse/STOP-140

  • New feature (non-breaking change which adds functionality)

…nName in RMNCHMBeneficiarydetail and RMNCHBeneficiaryDetailsRmnch
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6944a8d0-c686-4fdf-b151-de52b1af8a4d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@vishwab1
vishwab1 merged commit a53abde into PSMRI:release-3.8.4 Jul 16, 2026
1 of 3 checks passed
@sonarqubecloud

Copy link
Copy Markdown

vishwab1 pushed a commit that referenced this pull request Jul 17, 2026
…nName in RMNCHMBeneficiarydetail and RMNCHBeneficiaryDetailsRmnch (#175)
vanitha1822 added a commit that referenced this pull request Sep 3, 2026
* Update pom.xml

* Merge Release 3.6.2 to Main (#163)

* Elasticsearch implementation for Beneficiary Search (#123)

* fix: ES Implementation-mapping, indexing and async records

* fix: add service for ES Search

* fix: search implementation

* fix: add additional fields as per the requirement

* fix: comment extra fields

* fix: rename the files, remove commented code

* fix: update pom.xml

* fix: revert advancesearch

* fix: add properties

* fix: coderabbit comments

* fix: remove comment code

* fix: accept numeric values for search

* fix: update the env variable

* fix: advance search functionality

* fix: update the advance search ES functionality

* fix: sync and fetch benid

* fix: size limit issue

* fix: improve response time

* fix: updated the end point to advancedSearchES

* fix: age issue while moving to nurse worklist (#130)

* Optimize the Elasticsearch for better Response Time (#131)

* fix: optimize the index and reduce the size

* fix: align indent

* fix: abha / health id issue

* fix: sync optimization

* fix: get abha created date

* fix: state issue

* fix: village issue

* fix: add abha details

* fix: abha fix and refresh index

* fix: refresh index

* fix: remove duplicate dependency

* fix: fuzzy search, resume, refresh api's

* fix: add middlename, maritalstatus

* fix: remove refresh while bulk indexing

* fix: add license

* fix: remove the bean function to create the index automatically (#133)

* Fix ES Issue in the Query (#137)

* fix: ES Exception

* fix: ES exception

* Nd/vs/fix es (#138)

* fix: ES Exception

* fix: ES exception

* fix: enable multi-word fuzzy search requirement (#139)

* fix: enable multi-word fuzzy search requirement

* Downgrade version from 3.6.2 to 3.6.1

* fix: multi-word search (#140)

* Fix the column mismatch issue in beneficiary search (#142)

* fix: column mismatch issue

* fix: update marital status

* add new column in rmnch table for death and child record

* add new column in rmnch table for death and child record

* Cherry-pick health and version API enhancements to release-3.6.1 (#145)

* feat(health,version): add health and version endpoints

* feat(health,version): add health and version endpoints without auth

* fix(health):  remove unused private methods

* fix(health): fix exception issue

* fix(health): redact error details for unauthenticated health checks

* fix code quality issues and reduce cognitive complexity

* feat(health): add MySQL health endpoint

* refactor(health): simplify MySQL health check and remove sensitive details

* fix(health): remove unused imports and variables

* refactor(health): address nitpicks (configurable ES scheme, log noise, graceful shutdown, record)

* fix(health): scope PROCESSLIST lock-wait check to application DB user

* refactor(health): remove unused params and reuse response/error constants

* fix(health): remove unused imports and methods

* chore(health): clean up unused imports, params, and dead helpers

* fix(health): avoid sharing JDBC connections across threads in advanced MySQL checks

* refactor(health): reuse REDIS_COMPONENT constant and extract nested try block

* fix(health): avoid blocking DB I/O under write lock and restore interrupt flag

* fix(health): cancel in-flight futures on generic failure

* feat(health,version): add index existance, read-only detection, canary write for elasticsearch health check

* refactor(health): reduce cognitive complexity, remove dead throws, and clean code smells

* Rebase 3.6.2 (#150)

* fix: enable multi-word fuzzy search requirement (#139)

* fix: enable multi-word fuzzy search requirement

* Downgrade version from 3.6.2 to 3.6.1

* fix: multi-word search (#140)

* Fix the column mismatch issue in beneficiary search (#142)

* fix: column mismatch issue

* fix: update marital status

* add new column in rmnch table for death and child record

* add new column in rmnch table for death and child record

* Cherry-pick health and version API enhancements to release-3.6.1 (#145)

* feat(health,version): add health and version endpoints

* feat(health,version): add health and version endpoints without auth

* fix(health):  remove unused private methods

* fix(health): fix exception issue

* fix(health): redact error details for unauthenticated health checks

* fix code quality issues and reduce cognitive complexity

* feat(health): add MySQL health endpoint

* refactor(health): simplify MySQL health check and remove sensitive details

* fix(health): remove unused imports and variables

* refactor(health): address nitpicks (configurable ES scheme, log noise, graceful shutdown, record)

* fix(health): scope PROCESSLIST lock-wait check to application DB user

* refactor(health): remove unused params and reuse response/error constants

* fix(health): remove unused imports and methods

* chore(health): clean up unused imports, params, and dead helpers

* fix(health): avoid sharing JDBC connections across threads in advanced MySQL checks

* refactor(health): reuse REDIS_COMPONENT constant and extract nested try block

* fix(health): avoid blocking DB I/O under write lock and restore interrupt flag

* fix(health): cancel in-flight futures on generic failure

* feat(health,version): add index existance, read-only detection, canary write for elasticsearch health check

* refactor(health): reduce cognitive complexity, remove dead throws, and clean code smells

---------

Co-authored-by: Saurav Mishra <saurav.mishra@bizbrolly.com>
Co-authored-by: Saurav Mishra <80103738+SauravBizbRolly@users.noreply.github.com>
Co-authored-by: KOPPIREDDY DURGA PRASAD <144464542+DurgaPrasad-54@users.noreply.github.com>

* feat(jwt): enhance jwt validation logging and public endpoint check (#151)

* fix: pom version (#152)

* Add the missing properties for 1097_Preprod (#153)

* fix: add the missing properties

* fix: update db url

* docs: add CLAUDE.md for Claude Code guidance

* fix: map sexualOrientationID during beneficiary update in 1097

convertIdentityEditDTOToMBeneficiarydetail() was missing sexualOrientationID
and sexualOrientationType, so the field was never persisted on update.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Sexual orientation data not reflecting under DB record (#157)

* fix: enable multi-word fuzzy search requirement (#139)

* fix: enable multi-word fuzzy search requirement

* Downgrade version from 3.6.2 to 3.6.1

* fix: multi-word search (#140)

* Fix the column mismatch issue in beneficiary search (#142)

* fix: column mismatch issue

* fix: update marital status

* add new column in rmnch table for death and child record

* add new column in rmnch table for death and child record

* Cherry-pick health and version API enhancements to release-3.6.1 (#145)

* feat(health,version): add health and version endpoints

* feat(health,version): add health and version endpoints without auth

* fix(health):  remove unused private methods

* fix(health): fix exception issue

* fix(health): redact error details for unauthenticated health checks

* fix code quality issues and reduce cognitive complexity

* feat(health): add MySQL health endpoint

* refactor(health): simplify MySQL health check and remove sensitive details

* fix(health): remove unused imports and variables

* refactor(health): address nitpicks (configurable ES scheme, log noise, graceful shutdown, record)

* fix(health): scope PROCESSLIST lock-wait check to application DB user

* refactor(health): remove unused params and reuse response/error constants

* fix(health): remove unused imports and methods

* chore(health): clean up unused imports, params, and dead helpers

* fix(health): avoid sharing JDBC connections across threads in advanced MySQL checks

* refactor(health): reuse REDIS_COMPONENT constant and extract nested try block

* fix(health): avoid blocking DB I/O under write lock and restore interrupt flag

* fix(health): cancel in-flight futures on generic failure

* feat(health,version): add index existance, read-only detection, canary write for elasticsearch health check

* refactor(health): reduce cognitive complexity, remove dead throws, and clean code smells

* fix: map sexualOrientationID during beneficiary update in 1097

convertIdentityEditDTOToMBeneficiarydetail() was missing sexualOrientationID
and sexualOrientationType, so the field was never persisted on update.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Vanitha S <116701245+vanitha1822@users.noreply.github.com>
Co-authored-by: Saurav Mishra <saurav.mishra@bizbrolly.com>
Co-authored-by: Saurav Mishra <80103738+SauravBizbRolly@users.noreply.github.com>
Co-authored-by: KOPPIREDDY DURGA PRASAD <144464542+DurgaPrasad-54@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: add getBenFamilyDetails API and fix searchFamily queries

- Add POST /family/getBenFamilyDetails endpoint that returns full family
  details (master record + all members) for a given beneficiaryRegId
- Fix searchFamily and searchFamilyWithFamilyId queries: replace
  noOfmembers > 0 guard with deleted=false filter so families with
  zero/null member count and soft-deleted records are handled correctly;
  also make villageId optional and use LIKE prefix match for familyName

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: preserve existing occupation and education when incoming values are null

During beneficiary edit, convertIdentityEditDTOToMBeneficiarydetail creates
a fresh entity and overwrites all columns on save. Added null-guards for
occupationId, occupation, educationId, and education so existing DB values
are preserved when the incoming DTO omits them — consistent with the existing
pattern for familyId and headOfFamily_Relation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: replace in-memory queue with SELECT FOR UPDATE SKIP LOCKED for BenRegId allocation (#159)

* aam-2126 Memeberlist is not displying properly

* fix: aam-2313 phone number leading with zero - removed zero (#161)

* Allowing numbers with zero is search by phone number. (#162)

* fix: aam-2313 phone number leading with zero - removed zero

* fix: aam-2313 serach by user phone number fix for number leading with zero

---------

Co-authored-by: Saurav Mishra <saurav.mishra@bizbrolly.com>
Co-authored-by: Saurav Mishra <80103738+SauravBizbRolly@users.noreply.github.com>
Co-authored-by: KOPPIREDDY DURGA PRASAD <144464542+DurgaPrasad-54@users.noreply.github.com>
Co-authored-by: SnehaRH <sneha@navadhiti.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: SnehaRH <77656297+snehar-nd@users.noreply.github.com>

* feat: write anthropometry from rmnch/syncDataToAmrit to i_beneficiarydetails.otherFields

Mobile sends height/weight/bmi/temperature in beneficiaryDetails payload.
i_beneficiarydetails_rmnch has no these columns so they were lost.
FLW-API getBeneficiaryData reads from otherFields (temperatureValue key).

- RMNCHBeneficiaryDetailsRmnch: @transient height/weight/bmi/temperature
- BenDetailRepo: updateOtherFieldsByBenRegId query
- RmnchDataSyncServiceImpl: merge anthropometry into otherFields after save

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: stamp vanID from Redis on all 4 RMNCH entities in syncDataToAmrit

Reads camp:vanID and camp:parkingPlaceID from Redis (written by MMU-API
on van login) and stamps them onto RMNCHBeneficiaryDetailsRmnch,
RMNCHBornBirthDetails, RMNCHCBACdetails, and RMNCHHouseHoldDetails when
the mobile payload carries VanID=null or 0. Also writes anthropometry
(height/weight/bmi/temperature) from mobile beneficiaryDetails payload
into i_beneficiarydetails.otherFields so FLW-API getBeneficiaryData can
return them. Gracefully skips if Redis has no camp configured.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: preserve @transient anthropometry fields lost after JPA saveAll merge

Hibernate merge() returns new managed instances that do not carry
@transient field values (height/weight/bmi/temperature). Keep a
reference to the original list before saveAll so the anthropometry
loop reads from objects that still have the mobile payload values.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: prevent camp:vanID deletion on every syncDataToAmrit call

getObject("camp:vanID", false, 0) was calling EXPIRE key 0 which
immediately deletes the key in Redis after every sync. Replaced with
getRaw() which reads the value without modifying TTL, so camp:vanID
persists across multiple syncs until MMU logout.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(stoptb): add stoptb.enforce.vanid flag to syncDataToAmrit

The Stop TB mobile app calls this RMNCH sync endpoint directly to save
household details. Same issue as elsewhere: vanID stamping is skipped
silently when Redis has no camp:vanID, so household records end up
with vanID=NULL. When stoptb.enforce.vanid=true, sync now fails with a
clear error instead.

* chore: bump version to 3.8.2

* fix duplicate ben id issue

* save abha id in health maping with beneficiaryID

* abha id add in entity class

* abha id add in entity class

* abha id add in entity class

* abha id add in entity class

* abha id add in entity class

* abha id add in entity class

* abha id add in entity class

* abha id add in entity class

* feat(STOP-148): add GPS location capture support for beneficiary and RMNCH records

Introduces GPS-related fields (gpsLatitude, gpsLongitude, digipin, gpsTimestamp, isGpsUnavailable, and gpsUnavailableReason) across beneficiary address and RMNCH domain models, including MBeneficiaryaddress, Address DTO, RMNCHBeneficiaryDetailsRmnch, and RMNCHHouseHoldDetails.

Enhances IdentityMapper and IdentityService to map and persist GPS information between incoming DTOs and beneficiary address entities.

Updates RmnchDataSyncServiceImpl to extract and synchronize GPS details from the nested i_bendemographics payload during beneficiary sync, and to parse gpsTimestamp from household details during RMNCH household data processing.

* feat(STOP-148): add GPS location capture support for beneficiary and RMNCH records

Introduces GPS-related fields (gpsLatitude, gpsLongitude, digipin, gpsTimestamp, isGpsUnavailable, and gpsUnavailableReason) across beneficiary address and RMNCH domain models, including MBeneficiaryaddress, Address DTO, RMNCHBeneficiaryDetailsRmnch, and RMNCHHouseHoldDetails.

Enhances IdentityMapper and IdentityService to map and persist GPS information between incoming DTOs and beneficiary address entities.

Updates RmnchDataSyncServiceImpl to extract and synchronize GPS details from the nested i_bendemographics payload during beneficiary sync, and to parse gpsTimestamp from household details during RMNCH household data processing.

* feat: stamp vanID from Redis on all 4 RMNCH entities in syncDataToAmrit

Reads camp:vanID and camp:parkingPlaceID from Redis (written by MMU-API
on van login) and stamps them onto RMNCHBeneficiaryDetailsRmnch,
RMNCHBornBirthDetails, RMNCHCBACdetails, and RMNCHHouseHoldDetails when
the mobile payload carries VanID=null or 0. Also writes anthropometry
(height/weight/bmi/temperature) from mobile beneficiaryDetails payload
into i_beneficiarydetails.otherFields so FLW-API getBeneficiaryData can
return them. Gracefully skips if Redis has no camp configured.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: preserve @transient anthropometry fields lost after JPA saveAll merge

Hibernate merge() returns new managed instances that do not carry
@transient field values (height/weight/bmi/temperature). Keep a
reference to the original list before saveAll so the anthropometry
loop reads from objects that still have the mobile payload values.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: prevent camp:vanID deletion on every syncDataToAmrit call

getObject("camp:vanID", false, 0) was calling EXPIRE key 0 which
immediately deletes the key in Redis after every sync. Replaced with
getRaw() which reads the value without modifying TTL, so camp:vanID
persists across multiple syncs until MMU logout.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(stoptb): add stoptb.enforce.vanid flag to syncDataToAmrit

The Stop TB mobile app calls this RMNCH sync endpoint directly to save
household details. Same issue as elsewhere: vanID stamping is skipped
silently when Redis has no camp:vanID, so household records end up
with vanID=NULL. When stoptb.enforce.vanid=true, sync now fails with a
clear error instead.

* chore: bump version to 3.8.2

* duplicate ben id issue

* Add server urls and update swagger workflow (#135)

* docs(readme): add documentation badge

* chore(swagger): automate swagger sync to amrit-docs

* chore(swagger): automate swagger sync to amrit-docs

* chore(swagger): update github workflow for swagger json

* fix(swagger): fix the stop api issue in swagger workflow

* fix(swagger): removed the unnecessary initial sleep

* chore(swagger): add env-driven Dev/UAT/Demo servers and update swagger workflow

* feat(STOP-148): add GPS location capture support for beneficiary and RMNCH records

Introduces GPS-related fields (gpsLatitude, gpsLongitude, digipin, gpsTimestamp, isGpsUnavailable, and gpsUnavailableReason) across beneficiary address and RMNCH domain models, including MBeneficiaryaddress, Address DTO, RMNCHBeneficiaryDetailsRmnch, and RMNCHHouseHoldDetails.

Enhances IdentityMapper and IdentityService to map and persist GPS information between incoming DTOs and beneficiary address entities.

Updates RmnchDataSyncServiceImpl to extract and synchronize GPS details from the nested i_bendemographics payload during beneficiary sync, and to parse gpsTimestamp from household details during RMNCH household data processing.

* feat(STOP-148): add GPS location capture support for beneficiary and RMNCH records (#167)

Introduces GPS-related fields (gpsLatitude, gpsLongitude, digipin, gpsTimestamp, isGpsUnavailable, and gpsUnavailableReason) across beneficiary address and RMNCH domain models, including MBeneficiaryaddress, Address DTO, RMNCHBeneficiaryDetailsRmnch, and RMNCHHouseHoldDetails.

Enhances IdentityMapper and IdentityService to map and persist GPS information between incoming DTOs and beneficiary address entities.

Updates RmnchDataSyncServiceImpl to extract and synchronize GPS details from the nested i_bendemographics payload during beneficiary sync, and to parse gpsTimestamp from household details during RMNCH household data processing.

Co-authored-by: Sehjot Singh Pannu <sehjot.singh@unthinkable.co>

* abha id add in entity class

* fix: fail open on Redis errors in token denylist check

A transient Redis connection blip during isTokenDenylisted() was
thrown as an exception and treated as authentication failure,
causing valid, unexpired JWTs to be intermittently rejected with
401 during normal API calls (e.g. beneficiary registration).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Revert "fix: fail open on Redis errors in token denylist check"

This reverts commit 03ad7fe.

* fix(STOP-148): use InputMapper Gson for createIdentity to parse epoch-millis gpsTimestamp

createIdentity() parsed the request body with a bare new Gson(), whose
default Timestamp adapter only accepts ISO8601 date strings. The new
gpsTimestamp field is sent as raw epoch millis, causing
JsonSyntaxException during parsing whenever GPS data is present. That
exception propagated up through JwtUserIdValidationFilter's catch
block and was misreported as a 401 Authorization error.

InputMapper already registers a Timestamp adapter that handles epoch
millis correctly; switch createIdentity() to use it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fixed issue of Query did not return a unique result: 2 results were returned in RMNCH

* fixed issue of Query did not return a unique result: 2 results were returned in RMNCH

* fix(datasync): add vanID column to BenGenID import INSERT query

SQL had 6 placeholders but object array had 7 elements including vanID,
causing parameter index out of bounds error. Added vanID to INSERT columns.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* attach logger in  response

* fix duplicate issue

* fix(rmnch): surface pinCode in beneficiary details sync response

permPinCode was already stored correctly in i_beneficiaryaddress but
was never surfaced in the RMNCH sync response, since the response DTO
had no pinCode field and the address mapping never copied it across.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Tuned DB connection pools and enable response compression (#172)

* chore: add trace logging to /id/create for registerNew debugging

Prints the raw request body, parsed IdentityDTO, and svc.createIdentity
result so a Linux-server trace can show whether the beneficiary is
actually being saved.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* chore: add trace logging to syncDataToAmrit

Prints request body and response so the AMRIT sync path can be
traced alongside the registerNew flow.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Fix the Elasticsearch Health Status (#173)

* fix: authenticate elasticsearch health probes against secured cluster

The /health Elasticsearch client was built without credentials, so probes
against a security-enabled cluster returned 401 and reported ES DOWN (forcing
overall status DOWN) even though ES was healthy. Inject elasticsearch.username/
password and attach a BasicCredentialsProvider, matching ElasticsearchConfig.
Auth is skipped when username is blank (ES security disabled).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: pom version

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(dob): add debug trace logging at DTO->entity mapping and around detailRepo.save

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* feat(household): add totalHhMembers and registeredAtCampSite fields

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Adding placeOfCurrentLiving, otherPlaceOfCurrentLiving and institutionName in RMNCHMBeneficiarydetail and RMNCHBeneficiaryDetailsRmnch (#175)

* chore(trace): log pinCode presence in i_bendemographics during syncDataToAmrit

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Revert "Tuned DB connection pools and enable response compression (#172)"

This reverts commit c0f6dea.

* fix(dob): stop global Timestamp adapter from nulling dob on GPS-enabled endpoints

The GPS feature (STOP-148) registered a custom Gson TypeAdapter<Timestamp>
globally on InputMapper's GsonBuilder to parse the new gpsTimestamp field.
Because it was global, it also intercepted dob, silently returning null
whenever the incoming date string didn't match one of its four hardcoded
formats.

- Add GpsTimestampAdapter, attached only via @JsonAdapter on the gpsTimestamp
  field (Address, RMNCHBeneficiaryDetailsRmnch, RMNCHHouseHoldDetails), so it
  can't affect any other Timestamp field.
- Remove the global registerTypeAdapter(Timestamp.class, ...) from both
  InputMapper.java copies, restoring Gson's default Timestamp parsing for
  dob and everything else (matching vb/stoptb).
- Revert createIdentity()'s parser back to a bare new Gson(), matching
  Common-API's RegisterBenificiaryServiceImpl, which also serializes the
  outgoing identity payload with a bare new Gson(). InputMapper's
  setDateFormat is incompatible with that wire format (non-zero-padded day),
  which is why dob was nulling specifically for beneficiaries born on the
  1st-9th of a month once createIdentity switched to InputMapper's Gson.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(household): accept Pincode key variant during RMNCH sync deserialization

FLW-Mobile-App's Household.kt serializes the field as "Pincode" (capital P),
but the entity had no @SerializedName so Gson's exact-case field matching
against "pincode" silently dropped the value on every sync.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* feat(household): add address column mapping to i_householddetails

New address VARCHAR(500) column added to i_householddetails so
household address can be captured once at HH Registration instead of
being duplicated per-member on i_beneficiaryaddress. Accepts both
"address" and "Address" keys during sync, following the same pattern
as the earlier pincode key-case bug.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Merge 3.8.2 code (#177)

* feat: write anthropometry from rmnch/syncDataToAmrit to i_beneficiarydetails.otherFields

Mobile sends height/weight/bmi/temperature in beneficiaryDetails payload.
i_beneficiarydetails_rmnch has no these columns so they were lost.
FLW-API getBeneficiaryData reads from otherFields (temperatureValue key).

- RMNCHBeneficiaryDetailsRmnch: @transient height/weight/bmi/temperature
- BenDetailRepo: updateOtherFieldsByBenRegId query
- RmnchDataSyncServiceImpl: merge anthropometry into otherFields after save

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: stamp vanID from Redis on all 4 RMNCH entities in syncDataToAmrit

Reads camp:vanID and camp:parkingPlaceID from Redis (written by MMU-API
on van login) and stamps them onto RMNCHBeneficiaryDetailsRmnch,
RMNCHBornBirthDetails, RMNCHCBACdetails, and RMNCHHouseHoldDetails when
the mobile payload carries VanID=null or 0. Also writes anthropometry
(height/weight/bmi/temperature) from mobile beneficiaryDetails payload
into i_beneficiarydetails.otherFields so FLW-API getBeneficiaryData can
return them. Gracefully skips if Redis has no camp configured.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: preserve @transient anthropometry fields lost after JPA saveAll merge

Hibernate merge() returns new managed instances that do not carry
@transient field values (height/weight/bmi/temperature). Keep a
reference to the original list before saveAll so the anthropometry
loop reads from objects that still have the mobile payload values.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: prevent camp:vanID deletion on every syncDataToAmrit call

getObject("camp:vanID", false, 0) was calling EXPIRE key 0 which
immediately deletes the key in Redis after every sync. Replaced with
getRaw() which reads the value without modifying TTL, so camp:vanID
persists across multiple syncs until MMU logout.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(stoptb): add stoptb.enforce.vanid flag to syncDataToAmrit

The Stop TB mobile app calls this RMNCH sync endpoint directly to save
household details. Same issue as elsewhere: vanID stamping is skipped
silently when Redis has no camp:vanID, so household records end up
with vanID=NULL. When stoptb.enforce.vanid=true, sync now fails with a
clear error instead.

* feat(STOP-148): add GPS location capture support for beneficiary and RMNCH records

Introduces GPS-related fields (gpsLatitude, gpsLongitude, digipin, gpsTimestamp, isGpsUnavailable, and gpsUnavailableReason) across beneficiary address and RMNCH domain models, including MBeneficiaryaddress, Address DTO, RMNCHBeneficiaryDetailsRmnch, and RMNCHHouseHoldDetails.

Enhances IdentityMapper and IdentityService to map and persist GPS information between incoming DTOs and beneficiary address entities.

Updates RmnchDataSyncServiceImpl to extract and synchronize GPS details from the nested i_bendemographics payload during beneficiary sync, and to parse gpsTimestamp from household details during RMNCH household data processing.

* feat(STOP-148): add GPS location capture support for beneficiary and RMNCH records (#167)

Introduces GPS-related fields (gpsLatitude, gpsLongitude, digipin, gpsTimestamp, isGpsUnavailable, and gpsUnavailableReason) across beneficiary address and RMNCH domain models, including MBeneficiaryaddress, Address DTO, RMNCHBeneficiaryDetailsRmnch, and RMNCHHouseHoldDetails.

Enhances IdentityMapper and IdentityService to map and persist GPS information between incoming DTOs and beneficiary address entities.

Updates RmnchDataSyncServiceImpl to extract and synchronize GPS details from the nested i_bendemographics payload during beneficiary sync, and to parse gpsTimestamp from household details during RMNCH household data processing.

Co-authored-by: Sehjot Singh Pannu <sehjot.singh@unthinkable.co>

* fix(STOP-148): use InputMapper Gson for createIdentity to parse epoch-millis gpsTimestamp

createIdentity() parsed the request body with a bare new Gson(), whose
default Timestamp adapter only accepts ISO8601 date strings. The new
gpsTimestamp field is sent as raw epoch millis, causing
JsonSyntaxException during parsing whenever GPS data is present. That
exception propagated up through JwtUserIdValidationFilter's catch
block and was misreported as a 401 Authorization error.

InputMapper already registers a Timestamp adapter that handles epoch
millis correctly; switch createIdentity() to use it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(datasync): add vanID column to BenGenID import INSERT query

SQL had 6 placeholders but object array had 7 elements including vanID,
causing parameter index out of bounds error. Added vanID to INSERT columns.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(rmnch): surface pinCode in beneficiary details sync response

permPinCode was already stored correctly in i_beneficiaryaddress but
was never surfaced in the RMNCH sync response, since the response DTO
had no pinCode field and the address mapping never copied it across.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(dob): stop global Timestamp adapter from nulling dob on GPS-enabled endpoints

The GPS feature (STOP-148) registered a custom Gson TypeAdapter<Timestamp>
globally on InputMapper's GsonBuilder to parse the new gpsTimestamp field.
Because it was global, it also intercepted dob, silently returning null
whenever the incoming date string didn't match one of its four hardcoded
formats.

- Add GpsTimestampAdapter, attached only via @JsonAdapter on the gpsTimestamp
  field (Address, RMNCHBeneficiaryDetailsRmnch, RMNCHHouseHoldDetails), so it
  can't affect any other Timestamp field.
- Remove the global registerTypeAdapter(Timestamp.class, ...) from both
  InputMapper.java copies, restoring Gson's default Timestamp parsing for
  dob and everything else (matching vb/stoptb).
- Revert createIdentity()'s parser back to a bare new Gson(), matching
  Common-API's RegisterBenificiaryServiceImpl, which also serializes the
  outgoing identity payload with a bare new Gson(). InputMapper's
  setDateFormat is incompatible with that wire format (non-zero-padded day),
  which is why dob was nulling specifically for beneficiaries born on the
  1st-9th of a month once createIdentity switched to InputMapper's Gson.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Sehjot Singh Pannu <sehjot.singh@unthinkable.co>

* feat(household): add totalHhMembers and registeredAtCampSite fields

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* feat(rmnch): add placeOfCurrentLiving, otherPlaceOfCurrentLiving, institutionName fields

* fix(household): accept Pincode key variant during RMNCH sync deserialization

FLW-Mobile-App's Household.kt serializes the field as "Pincode" (capital P),
but the entity had no @SerializedName so Gson's exact-case field matching
against "pincode" silently dropped the value on every sync.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* feat(household): add address column mapping to i_householddetails

New address VARCHAR(500) column added to i_householddetails so
household address can be captured once at HH Registration instead of
being duplicated per-member on i_beneficiaryaddress. Accepts both
"address" and "Address" keys during sync, following the same pattern
as the earlier pincode key-case bug.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* chore(release): bump version to 3.8.3

* fix(rmnch): stop garbage device timestamps from corrupting CreatedDate

i_beneficiarydetails_rmnch.CreatedDate was trusting whatever the syncing
device sent, with no validation. Confirmed on UAT: 48/463 rows future-dated
(up to 2026-08-29, ~3 weeks ahead), 6/463 stuck at the 1970 epoch default —
both classic broken-device-clock symptoms (never set, or set ahead).

Add isPlausibleDeviceTimestamp() (rejects null, epoch-default, and
future-dated values) and apply it in syncDataToAmrit()'s RMNCH beneficiary
details block:
- Existing record already has a plausible CreatedDate -> keep it; a later
  re-sync must never overwrite a good value with a possibly-bad one.
- Existing record's value is bad but this sync's incoming value is
  plausible -> self-heal using the incoming value.
- Neither is plausible (broken clock both times) -> fall back to server
  sync time as the least-wrong value instead of storing garbage.
- New record with a plausible device value -> trust it as-is, since
  offline captures legitimately sync well after the actual event.

Build verified: mvn -o clean compile, BUILD SUCCESS.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(stoptb): enforce vanID in createIdentity(), require explicit enforce.vanid config

- IdentityService.createIdentity(): previously had zero enforce-vanid
  check at all (only RmnchDataSyncServiceImpl had it) - now throws if
  vanID is missing and enforceVanID=true, matching the convention
  everywhere else
- Remove inline :false default from stoptb.enforce.vanid @value in both
  IdentityService and RmnchDataSyncServiceImpl - every properties file
  must set this explicitly now, so a forgotten config fails loudly at
  startup instead of running fail-open
- Add stoptb.enforce.vanid=false to the 1097_* profile properties
  (separate Maven build sharing these same classes, not a van
  deployment, so stays false, but must be explicit)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(stoptb): fix RMNCH VanID placeholder-zero and id/VanSerialNo collision

- RMNCHBeneficiaryDetailsRmnch: mobile sends VanID=0 as a placeholder
  (not null) for a fresh record - the existing '== null' check never
  caught it, leaving the real vanID from Redis unapplied. Now checks
  for both null and 0.
- Both RMNCHBeneficiaryDetailsRmnch and RMNCHHouseHoldDetails map their
  VanSerialNo column to a Java field literally named 'id' with no
  @SerializedName - any incoming JSON payload that happens to carry its
  own 'id' key collides with it during Gson deserialization, silently
  overwriting the intended VanSerialNo with whatever unrelated value the
  client sent (observed live: every row stuck at VanSerialNo=1). Added
  updateVanSerialNo() to both repos and call it after each saveAll(),
  same pattern already used for i_beneficiaryimage/i_beneficiaryaddress
  in IdentityService.createIdentity().
- Left RMNCHCBACdetails/RMNCHBornBirthDetails alone despite sharing the
  same id-collision pattern - not part of the Stop TB flow, zero rows
  in practice, out of scope for this fix.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(stoptb): read vanID from stoptb.van.id property instead of Redis

Redis (camp:vanID) was written once at MMU login and deleted globally,
unscoped, on ANY user's logout — a Redis outage or an unrelated user's
logout would silently break RMNCH sync on this camp. Each camp/van
already runs its own dedicated backend instance, so which van this is
never actually changes at runtime.

syncDataToAmrit() now reads vanID from the new stoptb.van.id property
(no inline default, every properties file must set it explicitly,
same convention as stoptb.enforce.vanid) instead of an inline Redis
lookup via RedisStorage. Removed the now-unused RedisStorage
dependency from this class.

Added stoptb.van.id=0 to the 1097 (Helpline) profile's properties
files too, since RmnchDataSyncServiceImpl is shared with that build
and the property now has no inline default.

Scope: vanID only, parkingPlaceID is not part of this change.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Removing duplicate fields in i_beneficiaryaddress table (#186)

Co-authored-by: Saurav Mishra <80103738+SauravBizbRolly@users.noreply.github.com>

---------

Co-authored-by: Amoghavarsh <93114621+5Amogh@users.noreply.github.com>
Co-authored-by: Vanitha S <116701245+vanitha1822@users.noreply.github.com>
Co-authored-by: Saurav Mishra <saurav.mishra@bizbrolly.com>
Co-authored-by: Saurav Mishra <80103738+SauravBizbRolly@users.noreply.github.com>
Co-authored-by: KOPPIREDDY DURGA PRASAD <144464542+DurgaPrasad-54@users.noreply.github.com>
Co-authored-by: SnehaRH <sneha@navadhiti.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: SnehaRH <77656297+snehar-nd@users.noreply.github.com>
Co-authored-by: Sehjot Singh Pannu <sehjot.singh@unthinkable.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants